package com.zhanqiao.controller;


import com.zhanqiao.Utils.GetDataSourceUtil;
import org.apache.commons.dbutils.QueryRunner;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;
import java.io.IOException;
import java.sql.SQLException;

public class MageDeleteController  extends HttpServlet{
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String mid= req.getParameter("mid");
        DataSource dataSource= GetDataSourceUtil.getDataSource();
        QueryRunner queryRunner=new QueryRunner(dataSource);
        try {
            queryRunner.update("DELETE from massage where mid="+mid);
            System.out.println("删除成功");
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
